/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.situ.studentmanagement.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public final class DBHelper {

    public static Connection getConnection() throws ClassNotFoundException, SQLException {
        String driver = "com.mysql.jdbc.Driver"; // 数据库驱动
        String url = "jdbc:MySQL://127.0.0.1:3306/studentman";// 数据库
        String user = "studentman"; // 用户名
        String password = "0000"; // 密码

        Class.forName(driver); // 加载数据库驱动
        Connection conn = DriverManager.getConnection(url, user, password);
        return conn;
    }
}
